home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_08_07
/
8n07071a
< prev
next >
Wrap
Text File
|
1990-06-17
|
574b
|
30 lines
typedef int Boolean;
const Boolean TRUTH = 1;
const Boolean FALSE = 0;
const int dim = 10;
class Stack {
public:
// initialize stack to sane state
Stack() { index = 0; }
// push a int value
void push(int x) { data[index++] = x; }
// remove top value and return it
int pop() { return data[--index]; }
// returns true if empty
Boolean isempty() { return index == 0;
// returns true if full
Boolean isfull() { return index >= dim; }
private:
int index;
int data[dim];
};